package chuancan;

public class TestDriver6 {
    public static void main(String[] args) {
        System.out.println("======函数按值传参====");
        System.out.println();
        test01();
        System.out.println();
        System.out.println("====函数按值传参==" +
                "student.setScore(student.getScore()+10);====");
        System.out.println();
        test02();
    }

    /**
     * 函数调用传参：按值传参
     */
  public  static  void test01(){
      //实参
      int score = 80;
      System.out.println("子方法调用前是实参的值："+score);
      test01_sbu(score);
  }
    /**
     * score 形参
     */
  public static void test01_sbu(int score){
      //改变形参的值
      score += 10;
      System.out.println("子方法改变了形参的值："+score);
  }


  public  static void  test02(){
      //实参
      Student student = new Student(70);
      System.out.println("子方法调用前的实参的值："+ student);
      //调用子方法
      test02_sbu(student);
      System.out.println("子方法调用后的实参的值："+student);

  }

    /**
     * 子函数
     * @param student 形参
     */
  public  static  void test02_sbu(Student student){

      //改变形参的值
      student.setScore(student.getScore()+10);
      System.out.println("子方法改变形参的值："+student);
  }
}
